<?php
	namespace Home\Controller;
    use Think\Controller\RestController;
    Class InfoController extends RestController {
		// 	    protected $allowMethod    = array('get','post','put'); // Rest允许的请求类型列表
		// 	    protected $allowType      = array('json'); // Rest允许请求的资源类型列表
		// protected $defaultType="json";
		// protected $allowOutputType=array('json' => 'application/json');
			
		 public function rest() {
			 //echo $this->_type;
			 $method=$this->_method."_json";
			 $result=$this->$method();
			 $this->response($result,"json");
		 }
        
		private function get_json(){
			$data['status']=1;
			$data['info']="就是个测试get";
			return $data;		
        }
        private function post_json(){
            // 输出id为1的Info的XML数据
			$data['status']=1;
			$data['info']="就是个测试post";
			return $data;
        }
        private function put_json(){
			$data['status']=1;
			$data['info']="就是个测试put";
			return $data;
        }
        private function delete_json(){
			$data['status']=1;
			$data['info']="就是个测试delete";
			return $data;
        }
		
    }
?>